watsonx Assistant Development
Prerequisites
- a Watson Discovery Instance
- a watsonx.ai Instance
Setup watsonx and Integrate with Watson Discovery
Create Watson Discovery Custom Extension
- If you do not have an Watsonx Assistant, create new bot and fill in all required information.
- Once created, in your assistant, navigate to "Integrations" page.
- Click "Build custom extensions" -> click "Next" -> Input Extension name
Watson Discovery
-> click "Next" - Download the Watson Discovery OpenAPI json file: watson-discovery-query-openapi.json and import file to WA. This file contains the configuration to enable accessing to watson discovery from watsonx assistant.
- click "Next" -> click "Finish"
- Lower Right corner of the Watson Disovery extension, click "Add" -> click "Add" -> click "Next"
- In Authentication page, in the Authentication type dropdown, select "Basic auth"
- For Username enter
apikey
- For password and discovery_url, within IBM Cloud -> resource list -> click on you Watson Discovery Instance
- You'd see the following view.
- Copy API Key and paste it in Password field.
- Copy URL and paste it in discovery_url and remove
https://
from the beginning of the string
- For Username enter
- Click "Next", click "Finish", click "Close"
Create watsonx.ai Custom Extension
- In your assistant, navigate to Integrations page, click "Build custom extension" -> click "Next" -> Input Extension name
watsonx.ai
-> click "Next" . - download json file: watsonx-openapi.json and import file to WA
- click "Next" -> click "Finish"
- Lower Right corner of the watsonx extension, click "Add" -> click "Add" -> click "Next"
- In Authentication page, in the Authentication type dropdown, select "OAuth 2.0"
- For Apikey, create and copy a new API key from API key
- For Server variables, select the region that matches where your environment is configured in.
- Click "Next", click "Finish", click "Close"
- Your Extensions section will appear as following screenshot once both Watson Discovery and watsonx.ai custom extensions were configured.
Configure watsonx Assistant action to integrate watsonx.ai and Watson Discovery for conversational search
Upload Actions:
- On the Actions page of watsonx Assistant, click on Global Settings.
- On the Upload/Download tab, click the Upload button and upload the file that was given to you by your IBM instructors.
- You will see the following after you've imported the json file to you Watsonx Assistant
- Configure the "Invoke watsonx generation API" action
- On Step 1, click "Edit extension" to setup watsonx.ai custom extension.
- For the Extension options, select "watsonx.ai" and for the Operation options, select "Generation"
- For "Parameters"
- set version to
watsonx_api_version
variable - set input to
model_input
variable - set model_id to
model_id
variable - set project_id to
watsonx_project_id
variable
- set version to
- Click "Apply", and click "Save".
Update session variables:
- within the Actions page, navigate to "Actions / Variables / Created by you".
- Set
discovery_project_id
andwatsonx_project_id
session variableinfoWhere to get credentials
- discovery_project_id: within Watson Discovery: Upper left Hamburger icon -> Integrate and deploy -> API Information. Copy Project ID and navigate back to watsonx assistant to paste it in the
Initial value
box of this Session variable. - watsonx_project_id: - Go to watsonx Platform - If you do not have an project, create a new project. - Check Services & integrations: Within the project, navigate to Manage -> Services & Integrations. If no services is associated, click "Associate Service" -> select "Watson Machine Learning" -> click "Associate". - Once you confirm WML is associated, Navigate to Manage -> General -> Details -> Project ID. Copy Project ID and navigate back to watsonx assistant to paste it in the
Initial value
of this Session variable.
- discovery_project_id: within Watson Discovery: Upper left Hamburger icon -> Integrate and deploy -> API Information. Copy Project ID and navigate back to watsonx assistant to paste it in the
- Once you've finished configuring the variables, click "Preview" on the lower right corner, and type in questions to test the Conversational Search in your assistant!
Final Check
Once the watsonx Assistant development is fully complete, you should see the status of actions showing green checkmarks, similar to screenshot below.